﻿using University.Workshop.Business;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using University.Workshop.Model;

namespace University.Workshop.Tests
{


    /// <summary>
    ///This is a test class for TransactionSendManagerTest and is intended
    ///to contain all TransactionSendManagerTest Unit Tests
    ///</summary>
    [TestClass()]
    public class TransactionSendManagerTest
    {
        PokerServer server = new PokerServer();

        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for SendCredit
        ///</summary>
        [TestMethod()]
        public void SendCreditTest()
        {
            server.InitializeServer(3000);
            TransactionSendManager target = new TransactionSendManager(); // TODO: Initialize to an appropriate value
            target.TransactionSendManagerConnectClient();
            string fromUserName = string.Empty; // TODO: Initialize to an appropriate value
            string toUserName = "GloriaCamacho"; // TODO: Initialize to an appropriate value
            long amountToSend = 0; // TODO: Initialize to an appropriate value
            long actualAmount = 0; // TODO: Initialize to an appropriate value
            int expected = 3; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.SendCredit(fromUserName, toUserName, amountToSend, actualAmount);
            Assert.AreEqual(expected, actual);
            server.DisconnectServer();
        }
        /// <summary>
        ///A test for SendCredit
        ///</summary>
        [TestMethod()]
        public void SendCreditTest_1()
        {
            server.InitializeServer(3000);
            TransactionSendManager target = new TransactionSendManager(); // TODO: Initialize to an appropriate value
            target.TransactionSendManagerConnectClient();
            string fromUserName = "PedroPuentes"; // TODO: Initialize to an appropriate value
            string toUserName = string.Empty; // TODO: Initialize to an appropriate value
            long amountToSend = 0; // TODO: Initialize to an appropriate value
            long actualAmount = 0; // TODO: Initialize to an appropriate value
            int expected = 3; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.SendCredit(fromUserName, toUserName, amountToSend, actualAmount);
            Assert.AreEqual(expected, actual);
            server.DisconnectServer();
        }
        /// <summary>
        ///A test for SendCredit
        ///</summary>
        [TestMethod()]
        public void SendCreditTest_2()
        {
            server.InitializeServer(3000);
            TransactionSendManager target = new TransactionSendManager(); // TODO: Initialize to an appropriate value
            target.TransactionSendManagerConnectClient();
            string fromUserName = "PedroPuentes"; // TODO: Initialize to an appropriate value
            string toUserName = "GloriaCamacho"; // TODO: Initialize to an appropriate value
            long amountToSend = 0; // TODO: Initialize to an appropriate value
            long actualAmount = 20000; // TODO: Initialize to an appropriate value
            int expected = 3; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.SendCredit(fromUserName, toUserName, amountToSend, actualAmount);
            Assert.AreEqual(expected, actual);
            server.DisconnectServer();
        }
        /// <summary>
        ///A test for SendCredit
        ///</summary>
        [TestMethod()]
        public void SendCreditTest_3()
        {
            server.InitializeServer(3000);
            TransactionSendManager target = new TransactionSendManager(); // TODO: Initialize to an appropriate value
            target.TransactionSendManagerConnectClient();
            string fromUserName = "PedroPuentes"; // TODO: Initialize to an appropriate value
            string toUserName = "GloriaCamacho"; // TODO: Initialize to an appropriate value
            long amountToSend = 1000; // TODO: Initialize to an appropriate value
            long actualAmount = 0; // TODO: Initialize to an appropriate value
            int expected = 3; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.SendCredit(fromUserName, toUserName, amountToSend, actualAmount);
            Assert.AreEqual(expected, actual);
            server.DisconnectServer();
        }
        /// <summary>
        ///A test for SendCredit
        ///</summary>
        [TestMethod()]
        public void SendCreditTest_4()
        {
            server.InitializeServer(3000);
            TransactionSendManager target = new TransactionSendManager(); // TODO: Initialize to an appropriate value
            target.TransactionSendManagerConnectClient();
            string fromUserName = "PedroPuentes"; // TODO: Initialize to an appropriate value
            string toUserName = "PedroPuentes"; // TODO: Initialize to an appropriate value
            long amountToSend = 1000; // TODO: Initialize to an appropriate value
            long actualAmount = 20000; // TODO: Initialize to an appropriate value
            int expected = 1; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.SendCredit(fromUserName, toUserName, amountToSend, actualAmount);
            Assert.AreEqual(expected, actual);
            server.DisconnectServer();
        }
        /// <summary>
        ///A test for SendCredit
        ///</summary>
        [TestMethod()]
        public void SendCreditTest_5()
        {
            server.InitializeServer(3000);
            TransactionSendManager target = new TransactionSendManager(); // TODO: Initialize to an appropriate value
            target.TransactionSendManagerConnectClient();
            string fromUserName = "PedroPuentes"; // TODO: Initialize to an appropriate value
            string toUserName = "GloriaCamacho"; // TODO: Initialize to an appropriate value
            long amountToSend = 1000; // TODO: Initialize to an appropriate value
            long actualAmount = 20000; // TODO: Initialize to an appropriate value
            int expected = 4; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.SendCredit(fromUserName, toUserName, amountToSend, actualAmount);
            Assert.AreEqual(expected, actual);
            server.DisconnectServer();
        }
        /// <summary>
        ///A test for SendCredit
        ///</summary>
        [TestMethod()]
        public void SendCreditTest_6()
        {
            server.InitializeServer(3000);
            TransactionSendManager target = new TransactionSendManager(); // TODO: Initialize to an appropriate value
            target.TransactionSendManagerConnectClient();
            string fromUserName = "Roberto"; // TODO: Initialize to an appropriate value
            string toUserName = "Gloria"; // TODO: Initialize to an appropriate value
            long amountToSend = 1000; // TODO: Initialize to an appropriate value
            long actualAmount = 20000; // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.SendCredit(fromUserName, toUserName, amountToSend, actualAmount);
            Assert.AreEqual(expected, actual);
            server.DisconnectServer();
        }
        /// <summary>
        ///A test for SendCredit
        ///</summary>
        [TestMethod()]
        public void SendCreditTest_7()
        {
            server.InitializeServer(3000);
            TransactionSendManager target = new TransactionSendManager(); // TODO: Initialize to an appropriate value
            target.TransactionSendManagerConnectClient();
            string fromUserName = "Roberto"; // TODO: Initialize to an appropriate value
            string toUserName = "YoNoExisto"; // TODO: Initialize to an appropriate value
            long amountToSend = 10000; // TODO: Initialize to an appropriate value
            long actualAmount = 2000; // TODO: Initialize to an appropriate value
            int expected = 4; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.SendCredit(fromUserName, toUserName, amountToSend, actualAmount);
            Assert.AreEqual(expected, actual);
            server.DisconnectServer();
        }
        /// <summary>
        ///A test for SendCredit
        ///</summary>
        [TestMethod()]
        public void SendCreditTest_8()
        {
            server.InitializeServer(3000);
            TransactionSendManager target = new TransactionSendManager(); // TODO: Initialize to an appropriate value
            target.TransactionSendManagerConnectClient();
            string fromUserName = "YoTampocoExisto"; // TODO: Initialize to an appropriate value
            string toUserName = "Roberto"; // TODO: Initialize to an appropriate value
            long amountToSend = 1000; // TODO: Initialize to an appropriate value
            long actualAmount = 20000; // TODO: Initialize to an appropriate value
            int expected = 4; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.SendCredit(fromUserName, toUserName, amountToSend, actualAmount);
            Assert.AreEqual(expected, actual);
            server.DisconnectServer();
        }
        /// <summary>
        ///A test for SendCredit
        ///</summary>
        [TestMethod()]
        public void SendCreditTest_9()
        {
            server.InitializeServer(3000);
            TransactionSendManager target = new TransactionSendManager(); // TODO: Initialize to an appropriate value
            target.TransactionSendManagerConnectClient();
            string fromUserName = "Roberto"; // TODO: Initialize to an appropriate value
            string toUserName = "Estoy Mal Escrito Y Es Demasiado Grande Asi que no me cuentes"; // TODO: Initialize to an appropriate value
            long amountToSend = 1000; // TODO: Initialize to an appropriate value
            long actualAmount = 20000; // TODO: Initialize to an appropriate value
            int expected = 2; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.SendCredit(fromUserName, toUserName, amountToSend, actualAmount);
            Assert.AreEqual(expected, actual);
            server.DisconnectServer();
        }
    }
}
